package com.neusoft.service.impl;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.neusoft.mapper.UserMapper;
import com.neusoft.core.User;
import com.neusoft.service.UserService;

@Service
public class UserServiceImpl implements UserService{
	
	@Autowired
	private UserMapper userMapper;

	@Override
	public User getUserByIdByPass(User user) {
		return userMapper.getUserByIdByPass(user);
	}

	@Override
	public int getPointByUser(String userId){
		User user=userMapper.getUserInfo(userId);
		return user.getPoints();
	}
	
	@Override
	public int getUserById(String userId) {
		return userMapper.getUserById(userId);
	}
	
	@Override
	public int saveUser(User user) {
		return userMapper.saveUser(user);
	}

	@Override
	public int updateUserImg(String userImg, String userId) {
		return userMapper.updateUserImg(userImg, userId);
	}

	@Override
	public void updateUserTypeByUserId(String userId, Integer businessId) {
		userMapper.updateUserTypeByUserId(userId, businessId);
	}
	
	@Override
	public Integer getWalletIdByUserId(String userId) {
		return userMapper.getWalletIdByUserId(userId);
	}

	@Override
	public void updateWalletId(String userId, int walletId) {
		userMapper.updateWalletId(userId, walletId);
	}

	@Override
	public String getUserIdByBusinessId(Integer businessId) throws Exception {
		return userMapper.getUserIdByBusinessId(businessId);
	}
}
